// 蜂窝蜜造平台生成代码，如手工更改，请添加到 .beeignore 忽略生成

package com.fowo.api.costAccounting.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fowo.api.costAccounting.entity.MonthlyCostReport;
import com.fowo.api.costAccounting.model.monthly.MonthlyCostReportItemVo;
import com.fowo.api.costAccounting.model.monthly.MonthlyCostReportSearchParamPo;
import com.fowo.api.costAccounting.model.monthly.MonthlyCostReportVo;
import java.util.Date;
import java.util.List;

import com.fowo.api.costAccounting.model.stock.StockVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface MonthlyCostReportMapper extends BaseMapper<MonthlyCostReport> {
  Page<MonthlyCostReportItemVo> pageSearch(
    @Param("page") Page page,
    @Param("search") MonthlyCostReportSearchParamPo search
  );
  List<MonthlyCostReportItemVo> search(
    @Param("search") MonthlyCostReportSearchParamPo search
  );
  Date searchLastUpdateTime(
    @Param("search") MonthlyCostReportSearchParamPo search
  );
  /**
   * 搜索满足条件的所有记录的编号列表
   * @param search 搜索参数
   * @return 编号列表
   */
  List<Long> searchIds(@Param("search") MonthlyCostReportSearchParamPo search);
  Long getIdByOrgId(@Param("orgId") Integer orgId);

  List<Long> getIdsByOrgId(@Param("list") List<Integer> list);

  Integer getOrgIdById(@Param("id") Long id);

  List<Integer> getOrgIdByIds(@Param("ids") List<Long> ids);
  MonthlyCostReportVo selectVoById(@Param("id") Long id);

  List<MonthlyCostReportItemVo> getByNowData(@Param("type") String type,@Param("beginDate")Date beginDate,@Param("endDate")Date endDate);

  void updateByType(@Param("item") MonthlyCostReport monthlyCostReport);

//    void insertCopy(@Param("beginDate")Date beginDate,@Param("endDate")Date endDate);

    List<MonthlyCostReportItemVo> getByPeriodId(@Param("type")String type,@Param("periodId") Long periodId);

  /**
   *
   * @param out 数据
   * @param periodId 会计月id
   * @param type  维度
   */
    void updateOutBatch(@Param("list")List<StockVo> out, @Param("periodId")Long periodId, @Param("type")Integer type);
    //成本月报copy到库存月结转
    void insertCopys(@Param("periodId")Long periodId );

    List<MonthlyCostReportItemVo> getByModelPeriodId(@Param("type")String type,@Param("periodId") Long periodId);

    Integer getByPeriodIdCount(@Param("periodId")Long periodId,@Param("itemId") Long itemId);

    void updateBatch(@Param("list")List<MonthlyCostReportItemVo> list, @Param("type")String type);

  void deleteByPeriodId(@Param("periodId")Long id);
}
